home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0012_Read CTRL-ALT-SHIFT Keys.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  46 lines

  1. {
  2. > I was sitting here thinking about how usefull it would be to be able
  3. > to check the status of the different Locks (eg. scroll lock, num lock
  4. > or how to do it.  I think it is some sort of Bios or Dos service??
  5. > Any help would be greatly appreciated.
  6.  
  7. The easiest way is to access BIOS memory at address 40h:17h
  8.  
  9. }
  10. Procedure TestKeys;
  11.  
  12. Var
  13.   Scroll_Lock,
  14.   Caps_Lock,
  15.   Num_Lock,
  16.   Ins,
  17.   Alt,
  18.   Ctrl,
  19.   Left_Shift,
  20.   Right_Shift : Boolean;
  21.   Bios_Keys   : Byte Absolute $40:$17;
  22.  
  23. begin
  24.   Ins           := ((Bios_Keys And $80) = $80);
  25.   Caps_Lock     := ((Bios_Keys And $40) = $40);
  26.   Num_Lock      := ((Bios_Keys And $20) = $20);
  27.   Scroll_Lock   := ((Bios_Keys And $10) = $10);
  28.   Alt           := ((Bios_Keys And $8)  = $8);
  29.   Ctrl          := ((Bios_Keys And $4)  = $4);
  30.   Left_Shift    := ((Bios_Keys And $2)  = $2);
  31.   Right_Shift   := ((Bios_Keys And $1)  = $1);
  32.  
  33.   Writeln('Insert      : ', Ins);
  34.   Writeln('CapsLock    : ', Caps_Lock);
  35.   Writeln('NumLock     : ', Num_Lock);
  36.   Writeln('ScrollLock  : ', Scroll_Lock);
  37.   Writeln('Alt         : ', Alt);
  38.   Writeln('Control     : ', Ctrl);
  39.   Writeln('Left Shift  : ', Left_Shift);
  40.   Writeln('Right Shift : ', Right_Shift);
  41. end;
  42.  
  43. begin
  44.   TestKeys;
  45.   Readln;
  46. end.